<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>条件渲染</title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="div">
        <!-- 判断num的值，对3取余，余数为0显示div1的内容；为1，显示div2；为2，显示div3 -->
        <div v-if="num % 3 == 0">div1</div>
        <div v-else-if="num % 3 == 1">div2</div>
        <div v-else="num % 3 == 2">div3</div>

        <!-- v-show：根据条件展示某元素，区别在于切换的是display属性的值 -->
        <div v-show="flag">div4</div>
    </div>
</body>
<script>
    new Vue({
        el : "#div",
        data : {
            // num : 9,    // div1
            // num : 10,   // div2
            num : 11,   // div3
            flag : false
        }
    });
</script>
</html>